﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MISAPP.MISInterface;
using MISAPP.Classify.DataAccess;

namespace MISAPP.Classify.Service
{
    public class Service_WMG003
    {
        DA_WMG003 da = null;
        protected DA_WMG003 DA
        {
            get
            {
                if (da == null)
                {
                    da = new DA_WMG003();
                }
                return da;
            }
        }

        public DataSet GetCriteriaData()
        {
            return DA.GetCriteria();
        }

        public string[] GetCriteriaArray()
        {
            return DA.GetDistinctField();
        }

        public DataTable GetSummaryData(System.Collections.ArrayList p_criteria)
        {
            DataTable dt = null;
            if (p_criteria.Count != 1)
            {
                throw new Exception("參數傳遞錯誤!");
            }
            try
            {
                List<iSelectList> criteriaList = p_criteria[0] as List<iSelectList>;
                SelectList SL = criteriaList[0] as SelectList;
                string[] yms = SL.GetListArray();
                dt = DA.GetSummaryData(yms[0]);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return dt;
        }
    }
}
